using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

namespace ShootMan
{
    public class YooAssetsBuildHelper
    {
        [MenuItem("YooAsset/刷新所有")]
        static void BuildAllPackage()
        {
            if (!EditorUtility.DisplayDialog("请确认", "是否开始构建主资源包，耗时可能较久", "开始", "取消"))
                return;

            BuildDefaultPackageBase(false);
            BuildConfigPackage();
            BuildScriptPackage();
            BuildAutioPackage();
        }

        [MenuItem("YooAsset/刷新默认资源")]
        static void BuildDefaultPackage()
        {
            BuildDefaultPackageBase(true);
        }
        static void BuildDefaultPackageBase(bool displayDialog)
        {
            if (displayDialog)
            {
                if (!EditorUtility.DisplayDialog("请确认", "是否开始构建主资源包，耗时可能较久", "开始", "取消"))
                    return;
            }

            shacoEditor.YooAssetsBuildHelper.BuildYooAssetPackage("DefaultPackage");
        }

        [MenuItem("YooAsset/刷新配置")]
        static void BuildConfigPackage()
        {
            shacoEditor.YooAssetsBuildHelper.BuildYooAssetPackage("configs");
        }

        [MenuItem("YooAsset/刷新脚本")]
        static void BuildScriptPackage()
        {
            shacoEditor.HybridAutoGenerateHelper.RefeshOutputDllsBase(false);
            shacoEditor.YooAssetsBuildHelper.BuildYooAssetPackage("scripts");

        }

        [MenuItem("YooAsset/刷新音频")]
        static void BuildAutioPackage()
        {
            shacoEditor.YooAssetsBuildHelper.BuildYooAssetPackage("audio");
        }

        [MenuItem("YooAsset/刷新编辑器模拟资源列表")]
        static void YooAsset_RefreshSimulatorAsset()
        {
            shacoEditor.YooAssetsBuildHelper.BuildYooAssetSimulatorManifest("DefaultPackage");
            shacoEditor.YooAssetsBuildHelper.BuildYooAssetSimulatorManifest("configs");
            shacoEditor.YooAssetsBuildHelper.BuildYooAssetSimulatorManifest("scripts");
            shacoEditor.YooAssetsBuildHelper.BuildYooAssetSimulatorManifest("audio");
            AssetDatabase.Refresh();
        }
    }
}
